Skip to content

sched: add task repetition functionality#279

Merged
wipawel merged 1 commit into
KernelTestFramework:mainlinefrom
wipawel:task_repeat
Aug 21, 2023
Merged

sched: add task repetition functionality#279
wipawel merged 1 commit into
KernelTestFramework:mainlinefrom
wipawel:task_repeat

Conversation

@wipawel

@wipawel wipawel commented Jul 21, 2023

Copy link
Copy Markdown
Contributor

By default tasks run once and get destroyed. It might be useful to run them in an infinite loop (task done -> task scheduled -> ...) in order to achieve tasks interleaving (multiple tasks scheduled on the same CPU).
It might be also useful to set an arbitrary value of repetitions for a given task.

This commit adds simple set_task_repeat() and set_task_loop() API to allow task repetitions.

Example use:

task_t *task1, *task2;

task1 = new_user_task("task1", func1, NULL);
task2 = new_kernel_task("task2", func2, NULL);

set_task_repeat(task1, 2); // Or: set_task_loop(task1);
schedule_task(task1, get_cpu(1));

set_task_repeat(task2, 2); // Or: set_task_loop(task2);
schedule_task(task2, get_cpu(1));

@wipawel wipawel added the improvement A small enhancement, that makes already implemented features better label Jul 21, 2023
@wipawel wipawel requested a review from a team as a code owner July 21, 2023 12:55
Comment thread common/sched.c Outdated
By default tasks run once and get destroyed. It might be useful to run
them in an infinite loop (task done -> task scheduled -> ...) in order
to achieve tasks interleaving (multiple tasks scheduled on the same
CPU).
It might be also useful to set an arbitrary value of repetitions for a
given task.

This commit adds simple set_task_repeat() and set_task_loop() API to
allow task repetitions.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@grsecurity.net>
@wipawel wipawel enabled auto-merge (rebase) July 25, 2023 09:13
Comment thread include/sched.h
@wipawel wipawel merged commit 810ad44 into KernelTestFramework:mainline Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement A small enhancement, that makes already implemented features better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants